package net.lab1024.sa.admin.module.business.erp.mmo.controller;

import net.lab1024.sa.admin.module.business.erp.mmo.domain.form.PwrordAddForm;
import net.lab1024.sa.admin.module.business.erp.mmo.domain.form.PwrordQueryForm;
import net.lab1024.sa.admin.module.business.erp.mmo.domain.form.PwrordUpdateForm;
import net.lab1024.sa.admin.module.business.erp.mmo.domain.vo.PwrordVO;
import net.lab1024.sa.admin.module.business.erp.mmo.service.PwrordService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 产品入库单 Controller
 *
 * @Author AKITA
 * @Date 2025-08-18 22:49:00
 * @Copyright AKITA
 */

@RestController
@Tag(name = "产品入库单")
public class PwrordController {

    @Resource
    private PwrordService pwrordService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/pwrord/queryPage")
    public ResponseDTO<PageResult<PwrordVO>> queryPage(@RequestBody @Valid PwrordQueryForm queryForm) {
        return ResponseDTO.ok(pwrordService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/pwrord/add")
    public ResponseDTO<Long> add(@RequestBody @Valid PwrordAddForm addForm) {
        return pwrordService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/pwrord/update")
    public ResponseDTO<String> update(@RequestBody @Valid PwrordUpdateForm updateForm) {
        return pwrordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/pwrord/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return pwrordService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/pwrord/delete/{id}")
    public ResponseDTO<String> batchDelete(@PathVariable Long id) {
        return pwrordService.delete(id);
    }

    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/pwrord/info/{id}")
    public ResponseDTO<PwrordVO> info(@PathVariable Long id) {
        return pwrordService.info(id);
    }

    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/pwrord/infoUnexecute/{id}")
    public ResponseDTO<PwrordVO> infoUnexecute(@PathVariable Long id) {
        return pwrordService.infoUnexecute(id);
    }
}
